import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { MedicationTimeVO, MedicationTimeForm, MedicationTimeQuery } from '@/api/stroke/medicationTime/types';

/**
 * 查询健康指标中的用药时间点列表
 * @param query
 * @returns {*}
 */

export const listMedicationTime = (query?: MedicationTimeQuery): AxiosPromise<MedicationTimeVO[]> => {
  return request({
    url: '/stroke/medicationTime/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询健康指标中的用药时间点详细
 * @param id
 */
export const getMedicationTime = (id: string | number): AxiosPromise<MedicationTimeVO> => {
  return request({
    url: '/stroke/medicationTime/' + id,
    method: 'get'
  });
};

/**
 * 新增健康指标中的用药时间点
 * @param data
 */
export const addMedicationTime = (data: MedicationTimeForm) => {
  return request({
    url: '/stroke/medicationTime',
    method: 'post',
    data: data
  });
};

/**
 * 修改健康指标中的用药时间点
 * @param data
 */
export const updateMedicationTime = (data: MedicationTimeForm) => {
  return request({
    url: '/stroke/medicationTime',
    method: 'put',
    data: data
  });
};

/**
 * 删除健康指标中的用药时间点
 * @param id
 */
export const delMedicationTime = (id: string | number | Array<string | number>) => {
  return request({
    url: '/stroke/medicationTime/' + id,
    method: 'delete'
  });
};
